package com.wzd.eduservice.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wzd.eduservice.entity.EduComment;
import com.wzd.eduservice.mapper.EduCommentMapper;
import com.wzd.eduservice.service.EduCommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 评论 服务实现类
 * </p>
 *
 * @author wzd
 * @since 2021-03-04
 */
@Service
public class EduCommentServiceImpl extends ServiceImpl<EduCommentMapper, EduComment> implements EduCommentService {

    /**
     * @Method getCommentCountBycourseId
     * @Author wzd
     * @Description 该课程id下的评论总数
     * @Date 2021/5/28 14:43
     * @param id
     * @Return java.lang.Integer
     */
    @Override
    public Long getCommentCountBycourseId(String id) {
        QueryWrapper<EduComment> eduCommentQueryWrapper = new QueryWrapper<>();
        eduCommentQueryWrapper.eq("course_id",id);
        Integer integer = baseMapper.selectCount(eduCommentQueryWrapper);
        Long aLong = Long.valueOf(integer.toString());
        return aLong;
    }
}
